package com.financing.enums.invest;
import java.util.ArrayList;
import java.util.List;

public enum TradeCode {
	
	/** 代收-其它 */
	COLLECTION_OTHER("collecting_other", "1000", "代收-其它"),
	
	/** 代收投资金 */
	COLLECTION_INVEST("collecting_invest", "1001", "代收投资金"),
	
	/** 代收还款金 */
	COLLECTION_REFUND("collecting_refund", "1002", "代收还款金"),
	
	/** 代付-其他 */
	PAID_OTHER("paid_other", "2000", "代付-其他"),
	
	/** 代付借款金 */
	PAID_BORROW("paid_borrow", "2001", "代付借款金"),
	
	/** 代付（本金/收益）金 */
	PAID_BENEFIT("paid_benefit", "2002" , "代付（本金/收益）金");
	
	
	/** 枚举值 */
	private final String code;
	
	/** 枚举描述 */
	private final String message;
	
	/** 存储值 */
	private final String value;
	
	/**
	 * 构造一个<code>InvestStatus</code>枚举对象
	 * 
	 * @param code
	 * @param message
	 */
	private TradeCode(String code, String value, String message) {
		this.code = code;
		this.message = message;
		this.value = value;
	}
	
	/**
	 * @return Returns the code.
	 */
	public String getCode() {
		return code;
	}
	
	/**
	 * @return Returns the message.
	 */
	public String getMessage() {
		return message;
	}
	
	/**
	 * @return Returns the code.
	 */
	public String code() {
		return code;
	}
	
	/**
	 * @return Returns the message.
	 */
	public String message() {
		return message;
	}
	
	/**
	 * 通过枚举<code>code</code>获得枚举
	 * 
	 * @param code
	 * @return InvestStatus
	 */
	public static TradeCode getByCode(String code) {
		for (TradeCode _enum : values()) {
			if (_enum.getCode().equals(code)) {
				return _enum;
			}
		}
		return null;
	}
	
	public static TradeCode getByValue(String value) {
		for (TradeCode _enum : values()) {
			if (_enum.value == value) {
				return _enum;
			}
		}
		return null;
	}
	
	public String getValue() {
		return this.value;
	}
	
	/**
	 * 获取全部枚举
	 * 
	 * @return List<InvestStatus>
	 */
	public List<TradeCode> getAllEnum() {
		List<TradeCode> list = new ArrayList<TradeCode>();
		for (TradeCode _enum : values()) {
			list.add(_enum);
		}
		return list;
	}
	
	/**
	 * 获取全部枚举值
	 * 
	 * @return List<String>
	 */
	public List<String> getAllEnumCode() {
		List<String> list = new ArrayList<String>();
		for (TradeCode _enum : values()) {
			list.add(_enum.code());
		}
		return list;
	}
}
